<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        ul{
            display: none;
        }
    </style>
</head>
<body>
    <button onclick="add()">输入法</button>
    <ul>
        <li>手写</li>
        <li>拼音</li>
        <span onclick="add()">关闭</span>
    </ul>
</body>
<script>
    var fff = false
    let ul = document.getElementsByTagName('ul')[0]
    function add(){
        fff = !fff
        if(fff){
            ul.style.display = "block"
        }else{
            ul.style.display = "none"
        }
    }
</script>
</html>